#ifndef EZQTHREAD_H
#define EZQTHREAD_H

#include <QThread>
#include <QMap>
#include <QString>
#include <QVariant>
#include "EZTally/EZTallyObject.h"

class EZQThread;
typedef void (QObject::*EZQThreadFunc0)(EZQThread*);

class EZQThread : public QThread , public EZTally::EZTallyObject
{
    Q_OBJECT
public:
    explicit EZQThread(QObject *obj=0,EZQThreadFunc0 fun=0);
protected:
    virtual ~EZQThread();
    virtual void run();
public:
    EZQThreadFunc0 threadFunc() const;
    void setThreadFunc(EZQThreadFunc0 threadFunc);
    QObject *obj() const;
    void setObj(QObject *obj);

    QVariant getUserData(const QString &key);
    void setUserData(const QString &key,const QVariant &value);
private:
    EZQThreadFunc0 _threadFunc;
    QObject *_obj;

    QMap<QString,QVariant> _userDataMap;
private slots:
    void onFinish();
signals:

public slots:
    void Release();
    void start(Priority = InheritPriority);
};

#endif // EZQTHREAD_H
